home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
T&A 2 the Maxx 3
/
T and A 2 The Maxx Number 3.iso
/
viewers
/
unixview
/
xgl17dta.z
/
xgl17dta
/
strdup.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-24
|
1KB
|
40 lines
#ident "@(#)strdup.c 1.1 91/03/02 XGRASP"
/*-
* strdup.c - duplicate a string.
*
* Copyright (c) 1991 by Patrick J. Naughton
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* This file is provided AS IS with no warranties of any kind. The author
* shall have no liability with respect to the infringement of copyrights,
* trade secrets or any patents by this file or any part thereof. In no
* event will the author be liable for any lost revenue or profits or
* other special, indirect and consequential damages.
*
* Comments and additions should be sent to the author:
*
* Patrick J. Naughton
* Sun Microsystems
* 2550 Garcia Ave, MS 10-20
* Mountain View, CA 94043
* (415) 336-1080
*
*/
extern char *malloc();
extern unsigned strlen();
extern char *strcpy();
char *
strdup(s)
char *s;
{
char *new = malloc(strlen(s) + 1);
return (new ? strcpy(new, s) : (char *) 0);
}